<template>
  <div class="container">
    <web-view :src="urlWeb" bindmessage="getMessage"></web-view>
  </div>
</template>

<script>
  export default {
    components: { },
    data() {
      return {
        urlWeb: ''
      }
    },
    onLoad() {
      // 初始化data
      Object.assign(this.$data, this.$options.data())
    },
    onShow() {
      // 假设数据
      this.urlWeb = 'https://www.veekray.com/#/forget-password'
    },
    mounted() {
      // this.$pt.navigateBack({ delta: -1 })
    },
    methods: {
      getMessage(e) {
        console.log('getMessage 11111', e)
        let id = '11111111'
        let title = '222222222'
        let postData = {
          id: id,
          title: title
        }
        // 打包数据，发送给小程序接收区
        wx.miniProgram.postMessage({
          data: JSON.stringify(postData)
        })
        // 返回上级，触发微信小程序获取信息函数，读取之前发送的数据
        wx.miniProgram.navigateBack({
          delta: 1
        })
      }
    }
  }
</script>

<style lang="less" scoped>
  .container{
    background: #fff;
    min-height: calc(100vh);
  }  
</style>
